<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="app">
        <my-component v-model.capitalize='myText'></my-component>
        <span>{{myText}}</span>
    </div>

    <script>
        const option={
            data() {
                return {
                    myText:""
                }
            },
        }

        const MyCoponent={
            props:{
                modelValue:String,
                modelModifiers:{
                    default:()=>({})
                }
            },
            methods: {
                emitValue(e){
                    let value = e.target.value
                    if(this.modelModifiers.capitalize){
                        value = value[0].toUpperCase() + value.slice(1)
                    }
                    this.$emit('update:modelValue',value)
                }
            },
            template:`
                <input type="text"
                    :value="modelValue"
                    @input="emitValue"
                />
            `
        }

        const app = Vue.createApp(option)
        app.component('my-component', MyCoponent)
        const vm = app.mount("#app")
    </script>
</body>
</html>